package com.sc.nft.admin.controller;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.admin.request.AddDigitalCollectionRequest;
import com.sc.nft.admin.request.IdcardInfoRequest;
import com.sc.nft.admin.request.UpdateIsPassRequest;
import com.sc.nft.entity.DigitalCollection;
import com.sc.nft.entity.vo.IdcardInfoVO;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.exception.GlobalException;
import com.sc.nft.service.IdcardInfoService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/idCard")
@Api(tags="后台实名信息模块")
public class IdCardAdminController {

    private final IdcardInfoService idcardInfoService;

    @PostMapping(value="/pageIdCard", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "实名列表",notes ="实名列表",httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<IdcardInfoVO> pageIdCard(@Valid @RequestBody IdcardInfoRequest request) {
        Page<IdcardInfoVO> page = idcardInfoService.pageIdCard(request.getPageNo(), request.getPageSize(), request.getName(), request.getUserTel(), request.getUserEmail());
        return  PageResult.success(page);
    }


/*    @PostMapping(value="/updateIsPass", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "实名认证审核",notes ="实名认证审核",httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result updateIsPass(@Valid @RequestBody UpdateIsPassRequest request) throws GlobalException {

        idcardInfoService.updateIsPass(request.getId(),request.getIsPass());
        return  Result.success();
    }*/


}
